#include<bits/stdc++.h>
#define ll long long
#define L x<<1
#define R x<<1|1
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define Root 1,1,n
#define OK l>=Ll&&r<=Rr
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define pb push_back
#define ull unsigned ll
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned int 
inline ll read(){ll s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57) s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
const int N =1e6+5,M=1e6+5,inf=2147000000;
const ll llf=1e18;
using namespace std;
int n,h[N],to[N<<1],nxt[N<<1],cnt;
int st[N],top,ans[N],tp,f[N];
bool vis[N];
inline void add(int a,int b){
	to[++cnt]=b,nxt[cnt]=h[a],h[a]=cnt;
}
inline void dfs(int x,int fa){
	f[x]=fa;
	e(x)if(y^fa)dfs(y,x);
} 
int main(){
	freopen("choice.in","r",stdin);
	freopen("choice.out","w",stdout);
	n=read();
	for(int i=1,x,y;i^n;i++)x=read(),y=read(),add(x,y),add(y,x);
	ans[++tp]=1,vis[1]=1;
	dfs(1,0);
	rep(i,2,n){
		int x=i;
		while(!vis[x]){
			st[++top]=x;
			vis[x]=1;
			x=f[x];
		}
		while(top)ans[++tp]=st[top--]; 
	}
	rep(i,1,n)pf(ans[i]),putchar(' ');
	return 0;
}
